
#ifndef __SHELL_CHANNEL_H
#define __SHELL_CHANNEL_H

#include "../aprtools/APRBucketBrigade.h"
#include "../aprtools/APRFuture.h"
#include "SSHChannel.h"

/** Class encapsulating a secure shell through an SSH channel. */
class ShellChannel : public SSHChannel
{
   public:
      ShellChannel(SSHClient &itclient);
      virtual ~ShellChannel();
      LIBSSH2_CHANNEL *initialiseShellChannel();
      APRBucketBrigade *runCommandToBucket(LIBSSH2_CHANNEL *tchannel, const char *command);
      char *runCommandToString(LIBSSH2_CHANNEL *tchannel, const char *command);
      APRFuture<APRBucketBrigade *> *runCommandToBucketFuture(const char *command);
      APRFuture<char *> *runCommandToStringFuture(const char *command, ...);
      APRFuture<char *> *runCommandToStringFuture_simple(const char *command);
      static void *runCommandToBucketThread(apr_thread_t *tthread, void *args);
      static void *runCommandToStringThread(apr_thread_t *tthread, void *args);
   protected:
      /** Enables access to runCommandToBucket from a thread.
       * 
       * @return
       * Functor to runCommandToBucketThread. */
      virtual functor getRunCommandToBucketThread() const { return (functor)(&runCommandToBucketThread); }
      /** Enables access to runCommandToString from a thread.
       * 
       * @return
       * Functor to runCommandToStringThread. */
      virtual functor getRunCommandToStringThread() const { return (functor)(&runCommandToStringThread); }
};

#endif
